﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using System.Data.OracleClient;
namespace ConsoleTesrt.DBData
{
    public class SQLHelper
    {
        static void Main(string[] arg)
        {
            orac();
            Console.WriteLine(sd());
        }
        static int sd()
        {
            string a1s = ConfigurationManager.ConnectionStrings["mssql"].ConnectionString;//a1s
            SqlConnection conn = new SqlConnection("server=192.168.51.31;uid=sa;pwd=123456798;database=ctrldbv2;");
            conn.Open();
            SqlCommand comm = new SqlCommand("Select Name FROM SysObjects", conn);
            SqlDataAdapter sqlda = new SqlDataAdapter("Select Name FROM SysObjects", conn);
            DataSet ds = new DataSet();
            sqlda.Fill(ds);
            return 1;
        }
        static void orac()
        {
            var connectionString = @"Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)
(HOST=192.168.51.108) (PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=DEDICATED)));
User Id=szods; Password=123";
            OracleConnection oc = new OracleConnection(connectionString);
            oc.Open();//提示“System.Data.OracleClient 需要 Oracle 客户端软件 8.1.7 或更高版本。”
            // OracleCommand ocmm = new OracleCommand("select * from dir_test", oc);
            OracleDataAdapter ocda = new OracleDataAdapter("select * from dir_test", oc);
            DataSet ds = new DataSet();
            ocda.Fill(ds);

        }

    }
}
